define(['jquery','api','user','util'],function($,api,user,util){
	var vm, 
		noticeid,
	   controller = {
	   init:function(id){
	   	noticeid=id;
	   	   api.footerShow(0);//隐藏底部导航
		   api.setTitle(L('html_title_notice_detail'));
		   	api.headerShow(1);
			api.headerTitle(L('html_title_notice_detail'));
		   
		   this.render();
	   },
	   render:function(){
	   	   var that=this;
	   	   $('#common').html('<div id="notices"></div>');
	   	   
	       require(['text!pages/notice/detail.html','Vue'],function(tpl,Vue){
	            vm=new Vue({
	               el:'#notices',
	               data:{
	               		noRecord:'/static/img/none_content.png',
	               	  show:true,
	               	  loading:false,
	               	  noMore:false,//没有更多
	               	  notice:{}
	               },
	               filters:{
		              	contentFormat:function(s){
		              		var str=s.replace(/<\/?.+?>/g,"").replace(/&nbsp;/g,"");
		              	    return util.subString(str,70,1);
		              	},
		              	titleFormat:function(v){
		              	     return util.subString(v,35,1);
		              	}
		           },
	               methods:{
	               },
	               template:tpl
	            });
	            that.loadNotices();
	            
	       });
	       
	   },
	   loadNotices:function(){
	   		vm.loading=true;
//	   	   	vm.notice={
//	   	   		id:'1',title:'关于xxx公告',date:'2017-01-03',
//	   	   		content:'<img alt="" src="http://crm.wanbeikj.com/Uploads/Editor/2017-02-27/58b433b623046.jpg">'
//	   	   	};
	   	   api.notice(noticeid,function(rs){
	   	   	vm.loading=false;
	   	       if(rs.retcode==='0'){
	   	       		vm.noMore=false;
	   	           vm.notice=rs.data[0];
	   	       }else{
	   	       		vm.noMore=true;
	   	       }
	   	   })
	   },
	   onRouteChange:function(){
	       if(vm)vm.show=false;
	   }
	}
    return controller;
})